#include <stdio.h>

#define MAX_N   8

static char board[MAX_N][MAX_N+2];
static int N;
static int column_occupied[MAX_N] = { 0 };

/* i = first row to place; k = number of items to place */
int solve(int i, int k)
{
    int j, count;

    if (k == 0)     /* no more items to place */
        return 1;
    if (i == N)     /* no more room to place the remaining items */
        return 0;

    count = solve(i + 1, k);    /* place no item in this row */
    for (j = 0; j < N; j++)
    {
        if (board[i][j] == '#' && !column_occupied[j])
        {
            column_occupied[j] = 1;
            count += solve(i + 1, k - 1);
            column_occupied[j] = 0;
        }
    }
    return count;
}

int main()
{
    int K;
    while (scanf("%d %d", &N, &K) == 2 && N >= 0 && K >= 0)
    {
        int i;
        for (i = 0; i < N; i++)
            scanf("%s", board[i]);
        printf("%d\n", solve(0, K));
    }
    return 0;
}